/**
 * Created by cherry
 */

import api from '../../api/api';
import * as types from '../mutation';


const state = {
  shop:{
    nominate:[],
    evaluate:[],
    markable:[],
    img:[]

  }
};

const getters = {

  nomiList:state=>state.shop.nominate,
  evalList:state=>state.shop.evaluate,
  markList:state=>state.shop.markable,
  imageListData: state => state.shop.img

}

const actions = {
  getPromationList({commit}){
    api.getPromationList((res)=>{
      commit(types.ALL_NOMITATE_LIST_SUCESS,{res});
    })

  },
  getMarketList({commit}){
      api.getMarkList((res)=>{
        commit(types.ALL_MACK_LIST_SUCESS,{res});
      })
  },
  getEvalutateList({commit}){
    api.getEvalute((res)=>{
      commit(types.ALL_EVALUATE_LIST_SUCCESS,{res});
    })
  },
  getImgList({commit}){
    api.getImgList((res)=>{
      commit(types.ALL_IMG_LIST_SUCCESS,{res});
    });
  }

}

const mutations = {
  [types.ALL_NOMITATE_LIST_SUCESS](state,{res}){
      state.shop.nominate=res;

  },
  [types.ALL_MACK_LIST_SUCESS](state,{res}){
      state.shop.markable=res;
  },
  [types.ALL_EVALUATE_LIST_SUCCESS](state,{res}){
      state.shop.evaluate=res;
  },
  [types.ALL_IMG_LIST_SUCCESS](state,{res}){
    state.shop.img=res;

  }
}


export default{
    state,
    getters,
    actions,
    mutations
}
